package CodeProcess;

import model.EvaluationResult;
import model.TranslateResult;

/**
 * 套管处理器
 *
 * @author zzy
 * @version V1.0
 * @since 2022/8/31
 */
public class DrivepipeProcess {

    /**
     * 处理套管的内、外管壁厚结果，不走流程引擎
     *
     * @param param0 内管壁厚
     * @param param2 外管壁厚
     * @return
     */
    public static EvaluationResult doDrivepipeThinkness(Float param0, Float param2) {
        EvaluationResult evaluationResult = new EvaluationResult();
        String replace0 = ProjectCodeProcess.replace(String.valueOf(param0));
        String replace2 = ProjectCodeProcess.replace(String.valueOf(param2));

        TranslateResult translateResult1 = new TranslateResult(
                "内管壁厚",
                "T" + replace0,
                "内管壁厚" + replace0 + "mm",
                "内管壁厚>=" + replace0 + "mm"
        );

        TranslateResult translateResult2 = new TranslateResult(
                "外管壁厚",
                "T" + replace2,
                "外管壁厚" + replace2 + "mm",
                "不限"
        );

        evaluationResult.setThickness(translateResult1);
        evaluationResult.setOutThickness(translateResult2);
        return evaluationResult;
    }

    /**
     * 处理套管的外管直径结果，不走流程引擎
     *
     * @param params 外管直径
     * @return
     */
    public static EvaluationResult doDrivepipeDiameter(Float params) {
        String replace = ProjectCodeProcess.replace(String.valueOf(params));

        TranslateResult translateResult = new TranslateResult(
                "内管外径",
                "D" + replace,
                "内管外径" + replace + "mm",
                "内管外径>=" + replace + "mm"
        );

        if (params >= 25F) {
            translateResult.setSuit("内管外径>=25mm");
        }

        EvaluationResult evaluationResult = new EvaluationResult();
        evaluationResult.setDiameter(translateResult);
        return evaluationResult;
    }

}
